home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows4 / prndrv.zip / COPY.C < prev    next >
Text File  |  1992-02-20  |  2KB  |  87 lines

  1. //*************************************************************
  2. //  File name: COPY.C
  3. //
  4. //  Description:
  5. //      This file contains the function to get file date and
  6. //      time.
  7. //
  8. //  Functions:
  9. //             GetFileDateTime (int, unsigned int*, unsigned int *);
  10. //
  11. //  Comments:
  12. //
  13. //  Build Environment:
  14. //
  15. //      Windows SDK v3.0, C6.0
  16. //
  17. //  History:    Date       Author     Comment
  18. //              12/19/91   Eric Flo   Created
  19. //
  20. // Written by Microsoft Product Support Services, Windows Developer Support
  21. // Copyright (c) 1992 Microsoft Corporation. All rights reserved.
  22. //*************************************************************
  23.  
  24. /* Function proto-type for Interrupt 21 */
  25. void far pascal DOS3CALL (void);
  26.  
  27. //*************************************************************
  28. //
  29. //  GetFileDateTime()
  30. //
  31. //  Purpose:
  32. //              Gets the date and time of the file when it
  33. //              was last written to.
  34. //
  35. //
  36. //  Parameters:
  37. //      int   hFile       - File handle.
  38. //      unsigned * uTime  - Pointer to variable to contain the time.
  39. //      unsigned * uDate  - Pointer to variable to contain the date.
  40. //      
  41. //
  42. //  Return: (unsigned int)
  43. //
  44. //              0            if successful
  45. //              Error number if unsuccessful
  46. //
  47. //
  48. //  Comments:
  49. //              This function calls int 21 function 5700h to get
  50. //              the file date and time.
  51. //
  52. //
  53. //  History:    Date       Author     Comment
  54. //              12/23/91   Eric Flo   Created
  55. //
  56. //*************************************************************
  57.  
  58. unsigned int GetFileDateTime (int hFile, unsigned int* uTime,
  59.                               unsigned int* uDate)
  60.   {
  61.   unsigned int uResult;
  62.  
  63.   _asm
  64.      {
  65.      mov  bx,hFile            ; bx contains the file handle
  66.  
  67.      mov  ax,5700h            ; GetFileDateTime
  68.      call DOS3CALL
  69.  
  70.      jc   error
  71.      mov  bx,uTime
  72.      mov  WORD PTR [bx],cx    ; store time in uTime
  73.      mov  bx,uDate
  74.      mov  WORD PTR [bx],dx    ; store date in uDate
  75.      mov  uResult,0000h
  76.      jmp  done
  77.  
  78. error:                        ; Error
  79.      mov  uResult,ax
  80.  
  81. done:
  82.      }
  83.   return (uResult);
  84.   }
  85.  
  86. /* End of File */
  87.